﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ClearShould.cs" company="SaltFx">
//   Copyright (c) SaltFx - All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace SaltFx.Tests.LocalData
{
	using NUnit.Framework;

	/// <summary>
	/// The Local.Data.Clear method tests.
	/// </summary>
	public class ClearShould
	{
		/// <summary>
		/// Test to ensure that clearing non-empty local data is successful.
		/// </summary>
		[Test]
		public void ClearGivenDataExists()
		{
			// Arrange
			Local.Data["one"] = "This is a string";
			Local.Data["two"] = 99.9m;

			// Act
			Local.Data.Clear();

			// Assert
			Assert.AreEqual(0, Local.Data.Count);
		}

		/// <summary>
		/// Test to ensure that clearing empty local data in back-to-back calls doesn't cause an exception.
		/// </summary>
		[Test]
		public void NotThrowExceptionGivenSubsequentClears()
		{
			// Arrange

			// Act
			Local.Data.Clear();
			Local.Data.Clear();

			// Assert
			Assert.AreEqual(0, Local.Data.Count);
		}
	}
}